import request from '@/utils/request'

export function categoryTree() {
  return request({
    url: '/product/category/tree',
    method: 'get'
  })
}

export function categoryAdd(data) {
  return request({
    url: '/product/category/save',
    method: 'post',
    data
  })
}

export function categoryUpdate(data) {
  return request({
    url: '/product/category/update',
    method: 'post',
    data
  })
}

export function getById(id) {
  return request({
    url: '/product/category/getById',
    method: 'get',
    params: {id}
  })
}

export function getCategoryPathById(categoryId) {
  return request({
    url: '/product/category/getCategoryPathById',
    method: 'get',
    params: {categoryId}
  })
}

export function deleteCategory(data) {
  return request({
    url: `/product/category/delete`,
    method: 'post',
    data
  })
}

